package com.grandtech.insurance.common.core.spatial;



import com.grandtech.insurance.common.core.coding.Feature;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.index.strtree.STRtree;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class SpatialTree extends STRtree {


    public void insert(Feature feature) {
        super.insert(feature.getEnvelope(), feature);
    }

    public void insert(Geometry geometry) {
        super.insert(geometry.getEnvelope(), geometry);
    }


    public List copyQuery(Envelope searchEnv) {
        List src = super.query(searchEnv);
        List res = new ArrayList();
        Collections.copy(res, src);
        return res;
    }
}
